import React, { FC } from "react";
import { BadgePropsType } from "./PropsType";
import classnames from "classnames";
import "./index.less";
const Badge: FC<BadgePropsType> = (props) => {
  const {
    text,
    style = { backgroundColor: "#108ee9", borderRadius: "10px" },
    className,
    dot = false,
    size = "small",
    corner = false,
    count,
    overflowCount = 99,
    children,
  } = props;
  const cls = classnames("m-react-badge", className);
  const prefix='m-react-badge';
  return (
    <div className={`${cls} `} style={{ ...style }}>
      {dot ? (
        <div className={`dot m-react-badge-${size}`}></div>
      ) : (
        <div className={`${prefix}-text`}>
          <>{children}</>
          {text ||
            (count && count > overflowCount ? overflowCount + "+" : count)}
        </div>
      )}
    </div>
  );
};

export default Badge;
